// 3355. 零数组变换 I

// int[] nums = { 1, 0, 1 };
// int[][] queries = { [0, 2] };

// s.IsZeroArray(nums, queries);

public partial class Solution
{
    public bool IsZeroArray(int[] nums, int[][] queries)
    {
        var arr = new int[nums.Length + 1];

        foreach (var item in queries)
        {
            ++arr[item[0]];
            --arr[item[1] + 1];
        }

        int count = 0;
        for (int i = 0; i < nums.Length; i++)
        {
            count += arr[i];
            if (count < nums[i])
                return false;
        }

        return true;
    }
}